<%--
  Created by IntelliJ IDEA.
  User: Yy
  Date: 2022/5/12
  Time: 9:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.5.1.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/ajaxForm.js"></script>
    <script>
        layui.use(['form', 'laydate', 'layer'], function () {
            var form = layui.form, laydate = layui.laydate, layer = layui.layer;
            laydate.render({
                elem: '#birthday',
                type: 'date',//指定日期选择器类型 date,time,datetime
                trigger: 'click'
            });
            //监听表单提交
            form.on('submit(formbtn)', function () {
                $("#formsbt").ajaxSubmit({
                    type: "post",
                    url: '${pageContext.request.contextPath}/stu/updclass',
                    success: function (data) {//添加成功的回调函数
                        var index = parent.layer.getFrameIndex(window.name);//获取Frame索引
                        parent.layer.close(index);//关闭当前frame
                        parent.layui.table.reload("titleStu");//可以对父窗口进行刷新
                    }
                });
            });
            //给表单赋值
            $(function(){
                form.val('formsbt',${sclist})
                form.render();
            });
        });
    </script>
</head>
<body>
    <form class="layui-form" id="formsbt" lay-filter="formsbt">
<%--        id--%>
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input type="hidden" name="classId" class="layui-input"  lay-verify="required|chineseName"/>
<%--                <input type="hidden" name="classId" id="classId"  required lay-verify="" placeholder=""--%>
<%--                       autocomplete="off" class="layui-input" lay-verify="required">--%>
            </div>
        </div>

<%--    班级编号--%>
        <div class="layui-form-item">
            <label class="layui-form-label">班级编号</label>
            <div class="layui-input-inline">
                <input type="text" name="classno" id="classno" required lay-verify="" placeholder="班级编号"
                       autocomplete="off" class="layui-input" lay-verify="required">
            </div>
            <div class="layui-form-mid layui-word-aux">必填项班级编号</div>
        </div>

    <%--    班级名字--%>
        <div class="layui-form-item">
            <label class="layui-form-label">班级名字</label>
            <div class="layui-input-inline">
                <input type="text" name="className" id="className" required lay-verify="" placeholder="班级名字"
                       autocomplete="off" class="layui-input" lay-verify="required">
            </div>
            <div class="layui-form-mid layui-word-aux">必填项班级名字</div>
        </div>

    <%--    班级人数   判断--%>
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input type="hidden" name="count" id="count" value="0" required lay-verify="" placeholder="班级人数"
                       autocomplete="off" class="layui-input" lay-verify="required">
            </div>
        </div>

    <%--    teacher授课老师员工表外键--%>
        <div class="layui-form-item">
            <label class="layui-form-label">授课老师:</label>
            <div class="layui-input-inline">
                <select name="teacher">
                    <c:forEach items="${emplist}" var="e">
                        <option value="${e.empId}">${e.empName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

    <%--    teacher班主任员工表外键--%>
        <div class="layui-form-item">
            <label class="layui-form-label">班主任:</label>
            <div class="layui-input-inline">
                <select name="classTeacher">
                    <c:forEach items="${emplist}" var="e">
                        <option value="${e.empId}">${e.empName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

    <%--    班级类别,关联班级类别表--%>
        <div class="layui-form-item">
            <label class="layui-form-label">班级类别:</label>
            <div class="layui-input-inline">
                <select name="classType">
                    <c:forEach items="${ctlist}" var="e">
                        <option value="${e.calssTypeId}">${e.classTypeName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

    <%--    备注--%>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <input type="text" name="remark" id="remark" required lay-verify="" placeholder="备注"
                       autocomplete="off" class="layui-input" lay-verify="required">
            </div>
        </div>
    <%--    关联届别管理--%>
        <div class="layui-form-item">
            <label class="layui-form-label">届别:</label>
            <div class="layui-input-inline">
                <select name="fallId">
                    <c:forEach items="${falllist}" var="e">
                        <option value="${e.fallId}">${e.level}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

    <%--    关联系别--%>
        <div class="layui-form-item">
            <label class="layui-form-label">系别:</label>
            <div class="layui-input-inline">
                <select name="deptId">
                    <c:forEach items="${deptlist}" var="e">
                        <option value="${e.deptId}">${e.deptName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

    <%--    关联专业表--%>
        <div class="layui-form-item">
            <label class="layui-form-label">专业:</label>
            <div class="layui-input-inline">
                <select name="majorId">
                    <c:forEach items="${majorlist}" var="e">
                        <option value="${e.majorId}">${e.majorName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <button id="formbtn" type="button" lay-submit lay-filter="formbtn" class="layui-btn layui-btn-normal">
                保存
            </button>
<%--            <button id="reset" type="reset" lay-submit lay-filter="formbtn" class="layui-btn layui-btn-normal">--%>
<%--                重置--%>
<%--            </button>--%>
        </div>
    </form>
</body>
</html>
